package com.aspose.cells;

import java.util.ArrayList;
import java.util.Iterator;

class zbtz {
   boolean a = false;
   short b = 0;
   private String g;
   Font c;
   private ArrayList h;
   private int i = 7;
   private int j = 9;
   private boolean k = true;
   private int l = 2;
   private int m = 2;
   private int n = 2;
   boolean d = true;
   private int o;
   int e = 1;
   private Shape p;
   zpc f = null;
   private double q = 0.0D;
   private int r;

   int a() {
      return this.o;
   }

   void a(int var1) {
      this.o = var1;
   }

   public int b() {
      return this.m;
   }

   public void b(int var1) {
      this.m = var1;
   }

   int c() {
      return this.n;
   }

   void c(int var1) {
      this.n = var1;
   }

   private WorksheetCollection u() {
      return this.p.L();
   }

   zpc d() {
      if (this.f == null) {
         this.f = new zpc();
      }

      return this.f;
   }

   zbtz(Shape var1) {
      this.p = var1;
   }

   void a(zbtz var1) {
      this.m = var1.m;
      this.n = var1.n;
      this.g = var1.g;
      this.c = var1.c;
      this.i = var1.i;
      this.j = var1.j;
      this.k = var1.k;
      this.l = var1.l;
      this.r = var1.r;
      this.o = var1.o;
      if (var1.h != null && var1.h.size() != 0) {
         Iterator var2 = var1.h.iterator();

         while(var2.hasNext()) {
            FontSetting var3 = (FontSetting)var2.next();
            FontSetting var4 = this.a(var3.getStartIndex(), var3.getLength());
            var4.a(var3);
         }
      }

   }

   double e() {
      return this.q;
   }

   void a(double var1) {
      this.t();
      this.q = var1;
   }

   int f() {
      return this.l;
   }

   void d(int var1) {
      this.t();
      this.l = var1;
   }

   int g() {
      return this.i;
   }

   void e(int var1) {
      this.t();
      switch(var1) {
      case 1:
      case 3:
      case 6:
      case 7:
      case 8:
         this.i = var1;
      case 2:
      case 4:
      case 5:
      default:
      }
   }

   int h() {
      return this.j;
   }

   void f(int var1) {
      this.t();
      switch(var1) {
      case 0:
      case 1:
      case 3:
      case 6:
      case 9:
         this.j = var1;
      case 2:
      case 4:
      case 5:
      case 7:
      case 8:
      default:
      }
   }

   String i() {
      return this.g;
   }

   void a(String var1) {
      this.t();
      this.g = var1;
      this.h = null;
   }

   String j() throws Exception {
      return zfz.a(this);
   }

   void b(String var1) {
      this.t();
      if (this.p != null) {
         Shape var2 = this.p;
         zfz.a(var2, this, var1);
      }

   }

   void c(String var1) {
      this.t();
      this.g = var1;
   }

   Font k() {
      if (this.c == null) {
         this.c = new Font(this.u(), (Object)null, true);
         if (this.p != null && this.p.getMsoDrawingType() == 25) {
            this.c.a("Tahoma", 0);
            this.c.setSize(8);
            this.c.setBold(true);
            if (this.u().n().k()) {
               this.c.setSize(9);
            }
         } else if (this.u().n().k()) {
            this.c.b("Calibri");
            this.c.setSize(11);
         } else {
            this.c.b(this.c.getName());
            this.c.setSize(10);
         }
      }

      return this.c;
   }

   void a(Font var1) {
      this.t();
      this.c = var1;
   }

   Font l() {
      return this.c;
   }

   boolean m() {
      return this.k;
   }

   void a(boolean var1) {
      this.t();
      this.k = var1;
   }

   int n() {
      return this.c != null ? this.c.j() : this.r;
   }

   void g(int var1) {
      this.t();
      this.r = var1;
   }

   void h(int var1) {
      this.r = var1;
   }

   FontSetting a(int var1, int var2) {
      if (this.h == null) {
         this.h = new ArrayList();
      }

      FontSetting var3;
      for(int var4 = 0; var4 < this.h.size(); ++var4) {
         var3 = (FontSetting)this.h.get(var4);
         if (var3.getLength() == var2 && var3.getStartIndex() == var1) {
            return var3;
         }
      }

      var3 = new FontSetting(var1, var2, this.u(), true);
      if (this.c != null) {
         var3.getFont().c(this.c);
         var3.getFont().l();
      }

      com.aspose.cells.b.a.a.ze.a(this.h, (Object)var3);
      return var3;
   }

   void o() {
      a(this.h);
   }

   static void a(ArrayList var0) {
      FontSetting var1 = null;

      for(int var2 = 0; var2 < var0.size(); ++var2) {
         var1 = (FontSetting)var0.get(var2);
         boolean var3 = false;

         for(int var4 = var2 + 1; var4 < var0.size(); ++var4) {
            FontSetting var5 = (FontSetting)var0.get(var4);
            int var6;
            int var7;
            Font var8;
            Font var9;
            int var10;
            FontSetting var11;
            if (var1.getStartIndex() <= var5.getStartIndex()) {
               if (var1.getStartIndex() + var1.getLength() > var5.getStartIndex()) {
                  if (var1.getFont().equals(var5.getFont())) {
                     if (var1.getStartIndex() + var1.getLength() < var5.getStartIndex() + var5.getLength()) {
                        var1.c(var5.getStartIndex() + var5.getLength() - var1.getLength());
                     }

                     var0.remove(var4--);
                  } else {
                     var6 = var1.getStartIndex() + var1.getLength();
                     var7 = var5.getStartIndex() + var5.getLength();
                     if (var5.getStartIndex() == var1.getStartIndex()) {
                        if (!var3) {
                           var0.remove(var2);
                           --var2;
                           --var4;
                           var3 = true;
                        }
                     } else {
                        var1.c(var5.getStartIndex() - var1.getStartIndex());
                     }

                     var8 = new Font(var1.d, (Object)null, true);
                     var8.c(var1.getFont());
                     var8.d(var5.getFont());
                     var9 = var5.getFont();
                     if (var6 > var7) {
                        var10 = var6;
                        var6 = var7;
                        var7 = var10;
                        var9 = var1.getFont();
                     }

                     var5.c(var6 - var5.getStartIndex());
                     var5.a(var8);
                     if (var7 != var6) {
                        var11 = new FontSetting(var6, var7 - var6, var1.d, true);
                        var11.a(var9);
                        var0.add(var4 + 1, var11);
                        ++var4;
                     }
                  }
               }
            } else if (var5.getStartIndex() + var5.getLength() > var1.getStartIndex()) {
               var6 = var1.getStartIndex() + var1.getLength();
               var7 = var5.getStartIndex() + var5.getLength();
               var5.c(var5.getStartIndex() - var1.getStartIndex());
               var8 = var1.getFont();
               var9 = new Font(var1.d, (Object)null, true);
               var9.c(var1.getFont());
               var9.d(var5.getFont());
               var1.a(var9);
               if (var6 > var7) {
                  var10 = var7;
                  var7 = var6;
                  var6 = var10;
                  var8 = var5.getFont();
               }

               var1.c(var6 - var1.getStartIndex());
               if (var6 != var7) {
                  var11 = new FontSetting(var6, var7 - var6, var1.d, true);
                  var11.a(var8);
                  var0.add(var4 + 1, var11);
                  ++var4;
               }
            }
         }
      }

   }

   ArrayList p() {
      return this.h;
   }

   void b(ArrayList var1) {
      this.t();
      this.h = var1;
   }

   boolean q() {
      return this.p() != null && this.p().size() > 0;
   }

   ArrayList r() {
      if (this.h == null) {
         return null;
      } else {
         ArrayList var1 = this.s();
         a(var1);
         return var1;
      }
   }

   ArrayList s() {
      if (!this.q()) {
         return null;
      } else {
         boolean var1 = false;

         int var3;
         for(int var2 = 0; var2 < this.h.size(); ++var2) {
            var1 = false;

            for(var3 = this.h.size() - 2; var3 >= var2; --var3) {
               FontSetting var4 = (FontSetting)this.h.get(var3 + 1);
               FontSetting var5 = (FontSetting)this.h.get(var3);
               if (var4.getStartIndex() < var5.getStartIndex()) {
                  this.h.set(var3 + 1, var5);
                  this.h.set(var3, var4);
                  var1 = true;
               }
            }

            if (!var1) {
               break;
            }
         }

         ArrayList var8 = new ArrayList();
         var3 = 0;
         Font var9 = this.k();

         FontSetting var6;
         for(int var10 = 0; var10 < this.h.size(); ++var10) {
            var6 = (FontSetting)this.h.get(var10);
            if (var6.getStartIndex() != var3) {
               FontSetting var7 = new FontSetting(var3, var6.getStartIndex() - var3, this.u(), true);
               var7.getFont().c(var9);
               com.aspose.cells.b.a.a.ze.a(var8, (Object)var7);
            }

            com.aspose.cells.b.a.a.ze.a(var8, (Object)var6);
            var3 = var6.getStartIndex() + var6.getLength();
         }

         String var11 = this.i();
         if (var3 < var11.length()) {
            var6 = new FontSetting(var3, var11.length() - var3, this.u(), true);
            var6.getFont().c(var9);
            com.aspose.cells.b.a.a.ze.a(var8, (Object)var6);
         }

         return var8;
      }
   }

   void t() {
      if (this.p != null) {
         this.p.a(128L);
      }

   }
}
